<template>
	<view>
		我是广告
	</view>
</template>

<script>
	import store from '@/store/index.js';
	import {
		mapGetters,
		mapMutations,
		mapActions
	} from 'vuex';
	export default {
		data() {
			return {

			}
		},
		computed: {
			...mapGetters(['getLoveStartInfo', 'getLoveStartBanners', 'getIsLogin', 'getLoginUser'])
		},
		async onLoad() {
			// console.info(getCurrentPages());
			if (!this.getIsLogin) {
				await this.login();
			}
			this.navigatePath();
		},
		methods: {
			...mapActions(['login', 'updateLoginUser']),
			navigatePath() {
				// console.info(this.getLoginUser);
				if (this.getLoginUser.loveId != 0 && this.getLoginUser.spouseId !=0) {
					console.info('如果已经有对象直接跳转首页');
					uni.switchTab({
						url: '/pages/index/index'
					});
				} else if (this.getLoginUser.loveId === 0) {
					console.info('如果没有创建空间跳转到loveStart');
					uni.reLaunch({
						url: '/pages/loveStart/loveStart'
					});
				} else if (this.getLoginUser.spouseId === 0) {
					console.info('如果已经创建跳转到邀请页面');
					uni.reLaunch({
						url: '/pages/loveStart/sendLove'
					});
				} else {
					console.info('当前用户有问题');
					console.info(this.getLoginUser);
				}
			}

		}
	}
</script>

<style>

</style>